package com.project.file.config;

import io.minio.MinioClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author mengxj
 */
@Configuration
public class MinIoConfig {

    @Resource
    private FileProperties fileProperties;

    @Bean
    public MinioClient minioClient(){
        String serverPath = this.fileProperties.getServerPath();
        String accessKey = this.fileProperties.getAccessKey();
        String secretKey = this.fileProperties.getSecretKey();
        return MinioClient.builder().endpoint(serverPath).credentials(accessKey, secretKey).build();
    }
}
